package com.expert.miniapp.dto;

import com.expert.miniapp.dao.RecommendationItem;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * RecommendationItemSummaryDTO - �Ƽ���ϸ��Ϣ��չ DTO��
 * ���ڷ���չʾ�������Ƽ��������ݣ����ų� analysis_report �ֶΡ�
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RecommendationItemSummaryDTO {

    @JsonProperty("item_id")
    private String itemId;

    @JsonProperty("recommendation_id")
    private String recommendationId;

    @JsonProperty("rank_order")
    private Integer rankOrder;

    @JsonProperty("resource_type")
    private String resourceType;

    @JsonProperty("resource_id")
    private String resourceId;

    @JsonProperty("match_score")
    private BigDecimal matchScore;

    @JsonProperty("match_reason")
    private String matchReason;

    @JsonProperty("is_added_to_case")
    private Boolean addedToCase;

    @JsonProperty("is_added_to_resource")
    private Boolean addedToResource;

    @JsonProperty("created_at")
    private LocalDateTime createdAt;

    @JsonProperty("updated_at")
    private LocalDateTime updatedAt;

    public static RecommendationItemSummaryDTO fromEntity(RecommendationItem item) {
        return RecommendationItemSummaryDTO.builder()
                .itemId(item.getItemId())
                .recommendationId(item.getRecommendationId())
                .rankOrder(item.getRankOrder())
                .resourceType(item.getResourceType())
                .resourceId(item.getResourceId())
                .matchScore(item.getScore())
                .matchReason(item.getReason())
                .addedToCase(item.getIsAddedToCase())
                .addedToResource(item.getIsAddedToResource())
                .createdAt(item.getCreatedAt())
                .updatedAt(null)
                .build();
    }
}
